home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_1.3 / Read-Me1.3 / Printer1.3 / Driver.Examples / src / okimate20 / dospecial.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-08-01  |  2.1 KB  |  117 lines

  1. /*
  2.     DoSpecial for Okimate-20 driver.
  3.     David Berezowski - March/88.
  4. */
  5.  
  6. #include "exec/types.h"
  7. #include "../printer/printer.h"
  8. #include "../printer/prtbase.h"
  9.  
  10. DoSpecial(command, outputBuffer, vline, currentVMI, crlfFlag, Parms)
  11. char outputBuffer[];
  12. UWORD *command;
  13. BYTE *vline;
  14. BYTE *currentVMI;
  15. BYTE *crlfFlag;
  16. UBYTE Parms[];
  17. {
  18.     extern struct PrinterData *PD;
  19.     extern struct PrinterExtendedData *PED;
  20.  
  21.     int x = 0, i = 0;
  22.     static char initThisPrinter[] =
  23.         "\033I\001\022\0330\033%H\033-\376\015\033W";
  24.     static BYTE ISOcolTable[10] = {2, 1, 0, 0, 2, 1, 2, 0, 2, 2};
  25.  
  26.     if (*command == aRIN) {
  27.         while(x < 15) {
  28.             outputBuffer[x] = initThisPrinter[x];
  29.             x++;
  30.         }
  31.         outputBuffer[11] = '\000';
  32.         outputBuffer[x++] = '\000';
  33.  
  34.         if (PD->pd_Preferences.PrintQuality == LETTER) {
  35.             outputBuffer[2] = '\002';
  36.         }
  37.  
  38.         if (PD->pd_Preferences.PrintPitch == ELITE) {
  39.             outputBuffer[x++] = '\033';
  40.             outputBuffer[x++] = ':';
  41.         }
  42.         else if (PD->pd_Preferences.PrintPitch == FINE) {
  43.             outputBuffer[x++] = '\017';
  44.         }
  45.  
  46.         *currentVMI = 27; /* assume 8 lpi (27/216 = 1/8) */
  47.         if (PD->pd_Preferences.PrintSpacing == SIX_LPI) {
  48.             outputBuffer[x++] = '\033';
  49.             outputBuffer[x++] = 'A';
  50.             outputBuffer[x++] = '\014';
  51.             outputBuffer[x++] = '\033';
  52.             outputBuffer[x++] = '2';
  53.             *currentVMI = 36; /* 36/216 = 1/6 */
  54.         }
  55.         return(x);
  56.     }
  57.  
  58.     if (*command == aNEL) {
  59.         outputBuffer[x++] = '\015';
  60.         outputBuffer[x++] = '\012';
  61.         return(x);
  62.     }
  63.  
  64.     if (*command == aPLU) {
  65.         if (*vline == 0) {
  66.             *vline = 1;
  67.             *command = aSUS2;
  68.             return(0);
  69.         }
  70.         if (*vline < 0) {
  71.             *vline = 0;
  72.             *command = aSUS3;
  73.             return(0);
  74.         }
  75.         return(-1);
  76.     }
  77.  
  78.     if (*command == aPLD) {
  79.         if (*vline == 0) {
  80.             *vline = -1;
  81.             *command = aSUS4;
  82.             return(0);
  83.         }
  84.         if (*vline > 0) {
  85.             *vline = 0;
  86.             *command = aSUS1;
  87.             return(0);
  88.         }
  89.         return(-1);
  90.     }    
  91.  
  92.     if (*command == aSUS0) {
  93.         *vline = 0;
  94.     }
  95.     if (*command == aSUS1) {
  96.         *vline = 0;
  97.     }
  98.     if (*command == aSUS2) {
  99.         *vline = 1;
  100.     }
  101.     if (*command == aSUS3) {
  102.         *vline = 0;
  103.     }
  104.     if (*command == aSUS4) {
  105.         *vline = -1;
  106.     }
  107.  
  108.     if (*command == aVERP0) {
  109.         *currentVMI = 27;
  110.     }
  111.     if (*command == aVERP1) {
  112.         *currentVMI = 36;
  113.     }
  114.  
  115.     return(0);
  116. }
  117.